/**
 * Copyright 2015 jianglibo@gmail.com
 *
 */
package com.m3958.logcollector.tree;

/**
 * @author jianglibo@gmail.com
 *         2015年12月30日
 *
 */
public class TreeUpdateAction<T> {
    
    private long nodeId;
    
    private long treeId;
    
    private TreeUpdateActionName action;
    
    private String name;
    
    private T body;
    
    private long generatedNodeId;
    
    private TreeUpdateActionResult actionResult = TreeUpdateActionResult.SUCCESS;
    
    public TreeUpdateAction(){
        this.setActionResult(TreeUpdateActionResult.SUCCESS);
    }
    
    public TreeUpdateAction(long nodeId, String name, TreeUpdateActionName action) {
        this.setNodeId(nodeId);
        this.setAction(action);
        this.setName(name);
    }
    
    
    public T getBody() {
        return body;
    }
    public void setBody(T body) {
        this.body = body;
    }
    
    public TreeUpdateActionName getAction() {
        return action;
    }

    public void setAction(TreeUpdateActionName action) {
        this.action = action;
    }

    
    public TreeUpdateActionResult getActionResult() {
        return actionResult;
    }

    public void setActionResult(TreeUpdateActionResult actionResult) {
        this.actionResult = actionResult;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getTreeId() {
        return treeId;
    }

    public void setTreeId(long treeId) {
        this.treeId = treeId;
    }

    public long getNodeId() {
        return nodeId;
    }

    public void setNodeId(long nodeId) {
        this.nodeId = nodeId;
    }

    public long getGeneratedNodeId() {
        return generatedNodeId;
    }

    public void setGeneratedNodeId(long generatedNodeId) {
        this.generatedNodeId = generatedNodeId;
    }

    public static enum TreeUpdateActionResult {
        SUCCESS, FAIL, JSON_ERROR, DUPLICATED, EMPTY_NAME
    }

    public static enum TreeUpdateActionName {
        ADD, EDIT, DELETE
    }
}
